
allFuncs["SendForgotPassword"] = function() {
	var valid = new Validation('forgotfrm', {immediate:true});
	if (valid.validate()) {
		new Ajax.Request(self.location+'?ajax=1', {
			parameters: $('forgotfrm').serialize(true), 
			onLoading: function() { $('login-loading').toggle('appear'); },
			onComplete: function() { $('login-loading').toggle('appear'); },
			onSuccess: function(transport) { $('login-flash').innerHTML = transport.responseText; },
			onFailure: function(transport) { $('login-flash').innerHTML = " Ajax Request Failed "; }
		});
	}
	return false;
}

allFuncs["SubmitLogin"] = function() {
	var valid = new Validation('loginform', {immediate:true});
	if (valid.validate()) {
		new Ajax.Request(self.location+'?ajax=1', {
			parameters: $('loginform').serialize(true), 
			onLoading: function() { $('login-loading').toggle('appear'); },
			onComplete: function() { $('login-loading').toggle('appear'); },
			onSuccess: function(transport) { if (transport.responseText!='') $('login-flash').innerHTML = transport.responseText; else location = self.location; },
			onFailure: function(transport) { $('login-flash').innerHTML = " Ajax Request Failed "; }
		});
	}
	return false;
}
